<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:p="http://primefaces.org/ui">

    <ui:composition template="/template.xhtml">
        <ui:define name="content">
            <div align="center" >
                <h:panelGroup id="messagePanel" layout="block">
                    <h:messages errorStyle="color: red" infoStyle="color: green" layout="table"/>
                </h:panelGroup>
                <div align="center" style="width: 80%">
                    <h:form>
                        <p:panel header="Inserir Usuário">
                            <p:panelGrid columns="2">
                                <h:outputLabel value="#{bundle.CreateUsuarioLabel_nome}" for="nome" />
                                <p:inputText id="nome" value="#{usuarioController.selected.nome}" title="#{bundle.CreateUsuarioTitle_nome}" required="true" requiredMessage="#{bundle.CreateUsuarioRequiredMessage_nome}"/>
                                <h:outputLabel value="#{bundle.CreateUsuarioLabel_login}" for="login" />
                                <p:inputText id="login" value="#{usuarioController.selected.login}" title="#{bundle.CreateUsuarioTitle_login}" required="true" requiredMessage="#{bundle.CreateUsuarioRequiredMessage_login}"/>
                                <h:outputLabel value="#{bundle.CreateUsuarioLabel_senha}" for="senha" />
                                <p:password id="senha" value="#{usuarioController.selected.senha}" title="#{bundle.CreateUsuarioTitle_senha}" required="true" requiredMessage="#{bundle.CreateUsuarioRequiredMessage_senha}"/>
                                <h:outputLabel value="Confere Senha" for="conferesenha" />
                                <p:password id="conferesenha" value="#{usuarioController.confereSenha}" title="Confere Senha" required="true" requiredMessage="#{bundle.CreateUsuarioRequiredMessage_senha}"/>
                                <h:outputLabel value="#{bundle.CreateUsuarioLabel_idTipoUsuario}" for="idTipoUsuario" />
                                <p:selectOneMenu id="idTipoUsuario" value="#{usuarioController.selected.idTipoUsuario}" label="#{bundle.CreateUsuarioTitle_idTipoUsuario}" required="true" requiredMessage="#{bundle.CreateUsuarioRequiredMessage_idTipoUsuario}">
                                    <f:selectItems value="#{tipousuarioController.itemsAvailableSelectOne}"/>
                                </p:selectOneMenu>
                                <p:commandButton ajax="false" process="@this"  action="#{usuarioController.create}" value="#{bundle.CreateUsuarioSaveLink}" />
                                
                            </p:panelGrid>

                            <h:link outcome="/usuario/List" value="#{bundle.CreateUsuarioIndexLink}"/>
                        </p:panel>

                    </h:form>
                </div>
            </div>
        </ui:define>
    </ui:composition>

</html>
